package com.tanhua.server.controller;

import com.tanhua.domain.vo.VoiceVo;
import com.tanhua.server.service.VoiceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * Created with IntelliJ IDEA.
 *
 * @Auther: Alfred
 * @Date: 2021/04/20/9:36
 * @Description:
 */
@RestController
@RequestMapping("/peachblossom")
public class VoiceController {

    @Autowired
    private VoiceService voiceService;

    /**
    * @Description: 桃花传音-发送语音
    * @Param: [soundFile]
    * @return: org.springframework.http.ResponseEntity
    * @Author: Alfred
    * @Date: 2021/4/20
    */
    @PostMapping
    public ResponseEntity sendVoice(MultipartFile soundFile){
        voiceService.sendVoice(soundFile);
        return ResponseEntity.ok(null);
    }

    /**
    * @Description: 桃花传音-接受语音
    * @Param: []
    * @return: org.springframework.http.ResponseEntity
    * @Author: Alfred
    * @Date: 2021/4/20
    */
    @GetMapping
    public ResponseEntity getVoice(){
        VoiceVo voiceVo = voiceService.getVoice();
        return ResponseEntity.ok(null);
    }

}
